package DemoText;
import java.util.Scanner;
/**
 * 斐波那契数组
 */

public class LuoGuP8808 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = new int[n];


        for (int i = 0; i < n; i++) nums[i] = in.nextInt();
        int[] arr = new int[n];
        arr[1] = arr[0] = 1;
        for (int i = 2; i < n; i++)
            arr[i] = arr[i - 1] + arr[i - 2];
        int[] t = new int[1000000];
        for (int i = 0; i < n; i++) {
            if (nums[i] % arr[i] == 0) {

                int tmp = nums[i] / arr[i];
                t[tmp]++;
            }
        }


        int ret = 0;
        for (int i = 1; i < 1000000; i++)
            ret = Math.max(ret, t[i]);


        System.out.println(n - ret);
    }
}
